import unittest
import app
import uilt
from api.pyyuan公管理 import YuanGong

from parameterized import parameterized
class GongY(unittest.TestCase):
    @classmethod
    def setUpClass(cls) -> None:
        cls.ddd = YuanGong()

    filename = app.LUJING + "/data/" + ""
    @parameterized.expand(uilt.read1(filename))
    def test001_dl(self):
        repdata = {"mobile": "13800000002", "password": "123456"}
        a = self.ddd.deng(repdata)
        print(a.json())
        self.assertEqual(200,a.status_code)
        self.assertEqual(True,a.json().get("success"))
        self.assertIn("操作成功",a.json().get("message"))
    def test02_tianjia(self):
        repdata = {"username": "爱因斯坦",
                    "mobile": "17289437686",
                    "timeOfEntry": "2021-07-12",
                    "formOfEmployment": 1,
                    "departmentName": "测试0607",
                    "departmentId": "1412421425733664768",
                    "workNumber": "234",
                    "correctionTime": "2021-07-30T16:00:00.000Z"}
        b = self.ddd.jia(repdata)
        app.EMP_ID= b.json().get('data').get('id')
        # print(b.json())
    def test03_chaxun(self):
        c = self.ddd.cha(app.EMP_ID)
        # print(c.json())

    def test04_xiugai(self):
        repdata = {"username":"小猪佩奇"}
        d = self.ddd.xiugai(app.EMP_ID, repdata)
        # print(d.json())
    def test05_shanchu(self):
        q = self.ddd.shanchu(app.EMP_ID)
        # print(q.json())
    def test06_liebiao(self):
        list01 = self.ddd.chaliebiao()
        print(list01.json())
